home *** CD-ROM | disk | FTP | other *** search
- var aimAdminInfoCallback = new Object();
- var adminManager;
- var newPassword2;
- var newPassword1;
- var oldPassword;
-
- aimAdminInfoCallback.OnChangeInfoComplete = function(aimAdminInfoType)
- {
- aimErrorBox(aimString("msg.changePasswordSucess"));
- window.close();
- }
-
- aimAdminInfoCallback.OnChangeInfoError = function(aimAdminInfoType, errMsg)
- {
- aimErrorBox(errMsg);
- window.close();
- }
-
- aimAdminInfoCallback.OnRequestInfoComplete = function(aimAdminInfoType, info)
- {
- // Nothing fow now.
- }
-
- aimAdminInfoCallback.OnRequestInfoError = function(aimAdminInfoType, errMsg)
- {
- // Nothing fow now.
- }
-
- myAdminExecutionCallback = new Object();
- myAdminExecutionCallback.ExecuteIfReady = function()
- {
- try {
- adminManager.ChangePassword(aimAdminInfoCallback, newPassword2, oldPassword);
- }
- catch(ex) {
- dump("Failed to call ChangePassword. EX= " + ex + "\n");
- }
-
- }
-
- function AimChangePasswordWndOnLoad() {
- document.getElementById("mydeck").setAttribute("selectedIndex",0);
- doSetOKCancel(onOK, 0);
- document.getElementById("fldoldPassword").focus();
- }
-
- /*
- * Name: onOK (ChangePassword SC-01-01)
- *
- * Description:
- *
- * This function is called by the dialog overlay if the user hits the OK
- * button in the change password dialog. The function grabs the old, new
- * and confirm password from the dialog. It confirms that the lengths of
- * these password are valid, and displays error messages if not. These
- * passwords are stored in global variables by this function. Then an
- * instance of nsIAimAdminManager is obtained, and its ExecuteIfReady
- * method is called. ExecuteIfReady will asynchronously invoke the
- * myAdminExecutionCallback object, which is passed to
- * nsIAimManager::ExecuteIfReady via its ExecuteIfReady function, and
- * it is from there that we actually call into AIM Glue to have the
- * password changed.
- *
- * Return Value: none
- *
- * Original Code: Suresh Kasinathan
- *
- */
-
- function onOK() {
-
- /* get the values the user entered, and store in global variables
- so the ExecuteIfReady callback will be able to access them */
-
- newPassword1 = document.getElementById("fldNewPassword1").value;
- newPassword2 = document.getElementById("fldNewPassword2").value;
- oldPassword = document.getElementById("fldoldPassword").value;
-
- /* validate the passwords and display errors if not of the correct
- lengths */
-
- if((oldPassword.length < 4) || (oldPassword.length > 16)) {
- aimErrorBox(aimString("msg.BadOldPasswordlength"));
- return;
- }
-
- if(newPassword1 != newPassword2) {
- aimErrorBox(aimString("msg.BadNewPassword"));
- return;
- }
-
- if((newPassword1.length < 4) || (newPassword1.length > 16) || (newPassword2.length < 4) || (newPassword2.length > 16)) {
- aimErrorBox(aimString("msg.BadNewPasswordlength"));
- return;
- }
-
- /* if the passwords are the same, say the password change was successful.
- XXX what if the user thought they typed in a different password? The
- next time they login, it will fail them. We should display a message
- here that tells them the password was not changed because they entered
- the same value as the old password */
-
- if(newPassword1 == oldPassword) {
- aimErrorBox(aimString("msg.changePasswordSucess"));
- window.close();
- return;
- }
-
- /* XXX I don't know what this line of code does */
-
- document.getElementById("mydeck").setAttribute("selectedIndex",1);
-
- /* get an interface to nsIAimAdminManager */
-
- adminManager = aimAdminManager();
- if (!adminManager) {
- dump("Trying to create nsIAimAdminManager on my own..\n");
- adminManager = Components.classes['@netscape.com/aim/IMManager;1'].getService(Components.interfaces.nsIIMManager).QueryInterface(Components.interfaces.nsIAimAdminManager);
- if(!adminManager) {
- dump("Unable to create nsIAimAdminManager..\n");
- return;
- }
- }
-
- /* call ExecuteIfReady and pass our callback object so that IM Glue can
- call us when it is ready for us to actually change the password */
-
- try {
- adminManager.ExecuteIfReady(myAdminExecutionCallback);
- }
- catch(e) {
- dump("Unable to call ExecuteIfReady. ex = " + ex + "\n");
- }
-
- }
-
-
-
-
-